Null Space (Kernel)
Introduction
The null space (also called the kernel) of a matrix is the collection of all vectors that a linear transformation sends to the zero vector. If a matrix represents a transformation that “squashes” certain directions, the null space tells us exactly which directions disappear.
This article assumes you already know what a linear transformation is and how matrices act on vectors.
What the Null Space Represents
- The null space of a matrix $A$ is the set of all vectors $x$ such that $$Ax = 0.$$
- Geometrically, these are the directions that get flattened to a single point (the origin).
- If the null space contains only the zero vector, the transformation is injective (one‑to‑one).
- If the null space contains non‑zero vectors, the transformation collapses some dimension(s).
Why Null Spaces Matter
- They reveal whether a system of linear equations has unique or infinitely many solutions.
- They help classify transformations: stretching, rotating, projecting, flattening.
- They determine linear independence of columns:
- If the null space contains only $0$, the columns are linearly independent.
- If not, there is a non‑trivial linear combination of columns that equals $0$.
How to Compute a Null Space
To find all vectors $x$ such that $Ax = 0$:
- Write the augmented matrix for the system $Ax = 0$.
- Row‑reduce the matrix to reduced row‑echelon form (RREF).
- Identify pivot and free variables.
- Express the solution in terms of the free variables.
- Write the null space as all linear combinations of the resulting basis vectors.
A Simple Example
Consider the matrix $$A=\begin{pmatrix} 1 & 2 & -1 \\ 2 & 5 & 1 \\ -1 & -3 & 0 \end{pmatrix}.$$ We want all vectors $x$ such that $Ax=0$.
1. Form the system
Let $x=(x_1,x_2,x_3)$. Then
- $x_1 + 2x_2 - x_3 = 0$
- $2x_1 + 5x_2 + x_3 = 0$
- $-x_1 - 3x_2 = 0$
2. Row‑reduce the matrix
Start with the augmented matrix for $Ax=0$: $$\begin{pmatrix} 1 & 2 & -1 & 0 \\ 2 & 5 & 1 & 0 \\ -1 & -3 & 0 & 0 \end{pmatrix}.$$ Row‑reduce: $$\to \begin{pmatrix} 1 & 2 & -1 & 0 \\ 0 & 1 & 3 & 0 \\ 0 & -1 & -1 & 0 \end{pmatrix} \to \begin{pmatrix} 1 & 2 & -1 & 0 \\ 0 & 1 & 3 & 0 \\ 0 & 0 & 2 & 0 \end{pmatrix} \to \begin{pmatrix} 1 & 2 & -1 & 0 \\ 0 & 1 & 3 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix}.$$
3. Identify pivot and free variables
- Pivots in columns 1, 2, and 3.
- No free variables.
This means the only solution is the trivial one.
4. Solve the system
From the final matrix:
- $x_3 = 0$
- $x_2 + 3x_3 = 0 \Rightarrow x_2 = 0$
- $x_1 + 2x_2 - x_3 = 0 \Rightarrow x_1 = 0$
5. Describe the null space
All variables are forced to zero, so $$\text{Null}(A)=\{(0,0,0)\}.$$ A contrasting example works best when the null space is genuinely non‑trivial, so the reader sees free variables appear and a whole family of solutions emerge. This one mirrors the structure of the previous example but produces a one‑dimensional null space instead of a trivial one.
An example with a non‑trivial null space
Consider the matrix $$A=\begin{pmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 1 & 1 & 2 \end{pmatrix}.$$ We want all vectors $x=(x_1,x_2,x_3)$ such that $Ax=0$.
1. Form the system
The matrix corresponds to:
- $x_1 + 2x_2 + 3x_3 = 0$
- $2x_1 + 4x_2 + 6x_3 = 0$
- $x_1 + x_2 + 2x_3 = 0$
2. Row‑reduce the augmented matrix
Start with: $$\begin{pmatrix} 1 & 2 & 3 & 0 \\ 2 & 4 & 6 & 0 \\ 1 & 1 & 2 & 0 \end{pmatrix}.$$ Row‑reduce: $$\to \begin{pmatrix} 1 & 2 & 3 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & -1 & -1 & 0 \end{pmatrix} \to \begin{pmatrix} 1 & 2 & 3 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 \end{pmatrix}.$$
3. Identify pivot and free variables
- Pivots in columns 1 and 2.
- Column 3 has no pivot → free variable.
Let $x_3 = t$.
4. Solve the system
From the second row:
- $x_2 + x_3 = 0 \Rightarrow x_2 = -t$.
From the first row:
- $x_1 + 2x_2 + 3x_3 = 0$
Substitute $x_2=-t$ and $x_3=t$: $$x_1 + 2(-t) + 3t = 0 \Rightarrow x_1 = -t.$$
5. Describe the null space
All solutions have the form: $$x = (-t,\,-t,\,t).$$ Factor out $t$: $$\text{Null}(A)=\{\, t(-1,-1,1) : t\in\mathbb{R} \,\}.$$ This null space is a line through the origin. It shows that the matrix collapses all vectors along the direction $(-1,-1,1)$ to zero, while acting non‑trivially on directions perpendicular to it.
Interpreting the Geometry
- A matrix with a large null space “kills” many directions.
- A projection matrix has a null space equal to the directions it removes.
- A matrix representing a 3D-to-2D projection has at least a 1‑dimensional null space.
- A matrix with full column rank has a trivial null space $\{0\}$.
Common Patterns
- More columns than rows → null space is usually non‑trivial.
- Rank–nullity theorem: $$\text{rank}(A) + \text{nullity}(A) = \text{number of columns}.$$
- Nullity = number of free variables in the solution to $Ax = 0$.
Calculator
Finding the null space
- To calculate the null space for a matrix, you can use the $\operatorname{nullSpace}()$ function:
nullSpace([1, 2, 1; 0, 0, 0]) nullSpace([1, 2, 3; 2, 4, 6; 1, 1, 2])
Exercises
- Find the null space of $$A = \begin{pmatrix} 1 & -1 \\ 2 & -2 \end{pmatrix}.$$
- Determine all vectors $x$ such that $$\begin{pmatrix} 3 & 0 & 6 \\ 1 & 0 & 2 \end{pmatrix} x = 0.$$
- True or false: If the null space of a matrix contains a non‑zero vector, then its columns are linearly dependent.
- Compute the null space of $$A = \begin{pmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \end{pmatrix}.$$
- Describe in words the geometric meaning of a 2×3 matrix having a 1‑dimensional null space.
- Solve for the null space of $$A = \begin{pmatrix} 2 & 4 \\ 1 & 2 \\ 3 & 6 \end{pmatrix}.$$
- Let $$A = \begin{pmatrix} 1 & 0 & -1 \\ 0 & 1 & 1 \end{pmatrix}.$$ Find all $x$ such that $Ax = 0$.